package com.smart.thrift.model.wrapper;

import com.smart.thrift.model.common.ThriftServiceSignature;
import lombok.Data;

@Data
public class ThriftServiceWrapper {

    /**
     * 服务签名
     */
    private ThriftServiceSignature thriftServiceSignature;

    /**
     * 服务名
     */
    private String serviceName;

    /**
     * 对外服务的ifaceType
     */
    private Class<?> ifaceType;

    /**
     * 提供服务的版本号
     */
    private double version;

    /**
     * 具体提供服务的对象
     */
    private final Object targetService;

    private final static Double DEFAULT_VERSION = 1.0;

    public ThriftServiceWrapper(String serviceName, Class<?> ifaceType, Object targetService) {
        this(serviceName, ifaceType, targetService, DEFAULT_VERSION);
    }

    public ThriftServiceWrapper(String serviceName, Class<?> ifaceType, Object targetService, double version) {
        this.serviceName = serviceName;
        this.ifaceType = ifaceType;
        this.targetService = targetService;
        this.version = version;
    }
}
